<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!doctype html>
<html>
	<head>
		<base href="<%=basePath%>" />
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="renderer" content="webkit">
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<meta name="apple-mobile-web-app-title" content="Amaze UI" />
		<link rel="stylesheet" href="layui/css/layui.css" media="all"> <!-- 适应所有设备 -->
		<style type="text/css">
		</style>
	</head>
	<% String nowDay = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); %>
	<body>
	    <form class="layui-form" onsubmit="return false;">
	      <div class="layui-form-item">
	        <div class="layui-inline">
	          <label class="layui-form-label">标题</label>
	          <div class="layui-input-inline">
	          <input type="text" name="CustomTitle" id="CustomTitle" required="" lay-verify="required"  autocomplete="off" class="layui-input">
	          </div>
	        </div>
	      </div>
	      <div class="layui-form-item">
	        <div class="layui-inline">
	          <label class="layui-form-label">联系渠道</label>
	          <div class="layui-input-inline">
	            <select name="CustomChannel" id="CustomChannel">
		         <option value="微信">微信</option>
		         <option value="QQ">QQ</option>
		       </select>
	          </div>
	        </div>
	      </div>
	      <div class="layui-form-item">
	        <div class="layui-inline">
	          <label class="layui-form-label">联系号码</label>
	          <div class="layui-input-inline">
	          <input type="number" name="CustomPhone" id="CustomPhone" required="" lay-verify="required"  autocomplete="off" class="layui-input" min="0" >
	          </div>
	        </div>
	      </div>
	      <div class="layui-form-item">
	        <div class="layui-inline">
              <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="addname" id="addname">确认提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
              </div>
            </div>
        </div>
	  </form>
	
	    <script src="js/jquery.min.js"></script>
		<script src="layui/layui.js"></script>
		<script>
		    layui.use(['layer','form'],function(){
		    	var layer = layui.layer,
		    	    form  = layui.form;
		    	
		    	layer.config({
					extend: 'MySkin/style.css'
				});
		    	
		    	
		    	//定义开关
		    	form.on('submit(addname)',function(data){
		    		//console.log(parent.layui.table); //获取父页面的table
		    		setTimeout(function(){
		    			$.ajax({
		    				type:'POST',
		    				url:'game/setCustom',
		    				async:true,
		    				dataType:'json',
		    				data : {data : JSON.stringify(parent.layui.table)},
		    				success:function(resp){
		    					if(resp.message == null){
		    						layer.msg("操作成功",{icon:1});
		    						setTimeout(function(){
		    							var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
			                            parent.layer.close(index); //再执行关闭
			                            
			                            //把子页面改变的数据返回给父页面
			                            //parent.$("#BankPassword").text(data.field.password);
			                            //刷新顶层table表
			                            parent.layui.table.reload('AllTable',{});
			                            
		    						},2000);
		    					}else{
		    						layer.msg(resp.message,{icon:1});
		    						setTimeout(function(){
		    							var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
			                            parent.layer.close(index); //再执行关闭 
			                            parent.layui.table.reload('AllTable',{});
		    						},2000);
		    					}
		    				}
		    			});
		    		},1000);
		    		return false;
		    	});
		    });
		</script>
    </body>
</html>